﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserContral_DataPagerUserControl : System.Web.UI.UserControl
{
	
	public int _RecordCount = 0;
	protected int _PageCount = 0;

	private int _PageSize = 5;

	public int PageSize
	{
		get { return _PageSize; }
		set { _PageSize = value; }
	}

	private ListView _ListViewID;

	public ListView ListViewID
	{
		get { return _ListViewID; }
		set { _ListViewID = value; }
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		DataPager1.PageSize = _PageSize;
		_RecordCount = DataPager1.TotalRowCount;
		if (_RecordCount > 0)
		{
			_PageCount = (_RecordCount % DataPager1.PageSize) == 0 ? _RecordCount / DataPager1.PageSize : _RecordCount / DataPager1.PageSize + 1;
		}
		else
		{
			this.Visible = false;
		}
	}

	public void SetPage(int startIndex, int maxRows)
	{
		DataPager1.SetPageProperties(startIndex, maxRows, false);
	}
}
